package com.nx.qwr;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * @Author: Qingwr
 * @Date: 2022/8/14 16:39
 * @Description 流量统计Mapper
 */
public class FlowCountMapper extends Mapper<LongWritable, Text, Text, FlowBean> {

    //按照电话汇总流量
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String[] split = value.toString().split("\t");
        context.write(new Text(split[1]), new FlowBean(Integer.parseInt(split[6]),
                Integer.parseInt(split[7]), Integer.parseInt(split[8]), Integer.parseInt(split[9])));
    }
}
